def find_answer(question):
    with open('reply.txt', 'r', encoding='utf-8') as file:
        while True:
            line = file.readline()
            if line == '':
                break
            # 将回复内容进行劈分
            keyword = line.split('|')[0]
            reply = line.split('|')[1]
            if keyword in question:
                return reply
        return False


if __name__ == '__main__':
    question = input('亲~ 让您久等了！有什么问题请问吧：')
    while True:
        if question == 'bye':
            break
        else:
            reply = find_answer(question)
            if not reply:
                question = input('小二不知道您在说什么，您可以询问关于订单、物流、支付等问题，退出请输入bye：')
            else:
                print(reply)
                question = input('您还可以询问关于订单、物流、支付等问题，退出请输入bye：')
    print('小主，再见！')
